/**
 * 
 */
package org.going.invoker;

import javax.servlet.http.HttpServletRequest;

import org.going.utils.ClassUtils;

/**
 * @author ferendo.huang@gmail.com
 * 
 */
public class PrimitiveClassValueGeneratorImpl implements ParamValueGenerator
{

	@Override
	public Object generate(String index, Class<?> clazz, HttpServletRequest request) throws ParamValueGenerateException
	{
		String val = request.getParameter(index);
		if (String.class.equals(clazz))
		{
			return val;
		}
		return ClassUtils.toPrimitiveObject(clazz, val);
	}

	

}
